<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
<?php
$this->breadcrumbs = array(
    'Cari',
);
?>

<p>
    <?php
    if (isset($_POST['Search']['dari']) && !empty($_POST['Search']['dari']) && isset($_POST['Search']['ke']) && !empty($_POST['Search']['dari']) && isset($_POST['Search']['ke']) && !empty($_POST['Search']['date'])) {
        foreach ($Daris as $Dari) {
            $dariNama = $Dari->NAMA_KOTA;
        }
        foreach ($Kes as $Ke) {
            $keNama = $Ke->NAMA_KOTA;
        }
		foreach($KeretaM as $KeretaMurah){
			$hargaKeretaMurah = $KeretaMurah['HARGA_TIKET'];
		}
		foreach($BusM as $BusMurah){
			$hargaBusMurah = $BusMurah['HARGA_TIKET'];
		}
		foreach($TravelM as $TravelMurah){
			$hargaTravelMurah = $TravelMurah['HARGA_TIKET'];
		}
		foreach($KeretaC as $KeretaCepat){
			if($KeretaCepat['DURASI_KERETA']!='')
				$lamaKereta = $KeretaCepat['DURASI_KERETA'];
			else
				$lamaKereta = '-1';
		}
		foreach($BusC as $BusCepat){
			if($BusCepat['DURASI_BUS']!='')
				$lamaBus = $BusCepat['DURASI_BUS'];
			else
				$lamaBus = '-1';
		}
		foreach($TravelC as $TravelCepat){
			if($TravelCepat['DURASI_TRAVEL']!='')
				$lamaTravel = $TravelCepat['DURASI_TRAVEL'];
			else
				$lamaTravel = '-1';
		}

     ?>
    <table width="816" border="1"  style="vertical-align:top">
        <tr style="vertical-align:top">
            <td width="219" style="vertical-align:top"><table width="218" border="1" style="vertical-align:top" id="border">
                    <tr valign="top" style="vertical-align:top">
                        <td width="208">
                        <h3>Filter Hasil Pencarian</h3>
							<?php $jeniss = array('b'=>'Bus','k'=>'Kereta','t'=>'Travel');
                                $waktus = array('pagi'=>'Pagi (00.00 - 10.00)','siang'=>'Siang (10.00 - 15.00)','sore'=>'Sore (15.00 - 18.00)', 'malam'=>'Malam (18.00 - 00.00)');
                                $hargas = array('h1'=>'Rp 0 - Rp 250.000','h2'=>'Rp 250.000 - Rp 500.000','h3'=>'Rp 500.000 - Rp 750.000', 'h4'=>'&gt; Rp 750.000');
                            ?>
                            <h4>Jenis Transportasi</h4>
                            <div class="row">
                                <?php echo CHtml::checkBoxList('myCheckBoxList[jenis]', $jeniss, $jeniss); ?> 
                            </div><br />
                            <h4>Waktu</h4>
                            <div class="row">
                                <?php echo CHtml::checkBoxList('myCheckBoxList[waktu]', $waktus, $waktus); ?> 
                            </div><br />
                            <h4>Harga</h4>
                            <div class="row">
                                <?php echo CHtml::checkBoxList('myCheckBoxList[harga]', $hargas, $hargas); ?> 
                            </div><br />
                            </td>
                    </tr>
                </table></td>
            <td width="581" style="vertical-align:top"><table width="580" border="1" id="border">
                    <tr>
                        <td width="570" style="vertical-align:top"><h3>Hasil pencarian untuk <?php echo $dariNama ?> - <?php echo $keNama ?></h3>
                          <p>Keterangan:</p>
                          <p id="ket"><img src="../../../go3s/css/murah.png" /> = Perjalanan termurah</p> <p id="ket"><img src="../../../go3s/css/speed.png" /> = Perjalanan tercepat</p></p>
                            <table width="571" border="1">
                                <tr>
                                    <td width="561" ><h4><img src="../../../go3s/css/bus-icon.png" width="40" height="40" alt="bus" />Bus</h4>
                                        <table width="560" border="1">
                                          <tr id="theader"><?php $row = 0; ?>
                                                <th width="204" scope="col">Nama Bus</th>
                                                <th width="191" scope="col">Waktu</th>
                                                <th width="143" scope="col">Harga(Rp)</th>
                                          </tr>
                                             <?php if($jmlBus != 0){
											 	foreach ($Buss as $Bus) : ?>
                                                <?php if($row % 2 == 0) {?>
                                                	<tr align="center" id="genap"><?php }
												else {?>
                                                	<tr align="center" id="ganjil"><?php } ?>
                                                        <td><?php echo $Bus['NAMA_BUS']; ?></td>
                                                        <td ><?php 
															if(($Bus['DURASI_BUS']) == $lamaBus) echo $Bus['JAM_BERANGKAT'] . " - " . $Bus['JAM_PULANG'] . '<img src="../../../go3s/css/speed.png" />'; else echo  $Bus['JAM_BERANGKAT'] . " - " . $Bus['JAM_PULANG'];?></td>
                                                        <td ><?php 
															if($Bus['HARGA_TIKET'] == $hargaBusMurah) echo $Bus['HARGA_TIKET'] . '<img src="../../../go3s/css/murah.png" />'; else echo  $Bus['HARGA_TIKET'];?></td>
                                                    </tr>
												<?php $row++;
                                                endforeach; } else{?>
                                                <tr align="center" id="genap">
                                                	<td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                </tr><?php }?>
                                      </table>
                                  </td>
                              </tr>
                          </table>
                            <table width="570" border="1">
                                <tr>
                                    <td width="560"><h4><img src="../../../go3s/css/Travel_Bus.png" width="40" height="40" alt="travel" />  Travel</h4>
                                    <table width="560" border="1">
                                            <tr id="theader"><?php $row = 0; ?>
                                                <th width="108" scope="col">Nama Travel</th>
                                                <th width="207" scope="col">Waktu</th>
                                                <th width="62" scope="col">Kelas</th>
                                                <th width="73" scope="col">Harga(Rp)</th>
                                                <th width="76" scope="col">Pemesanan</th>
                                      </tr>
                                             <?php if($jmlTravel != 0){
												 foreach ($Travels as $Travel) : ?>
                                                <?php if($row % 2 == 0) {?>
                                                <tr align="center" id="genap"><?php }
												else {?>
                                                <tr align="center" id="ganjil"><?php } ?>
                                                    <td><?php echo $Travel['NAMA_TRAVEL']; ?></td>
                                                    <td><?php if(($Travel['DURASI_TRAVEL']) == $lamaTravel) echo $Travel['JAM_BERANGKAT'] . " - " . $Travel['JAM_PULANG'] . '<img src="../../../go3s/css/speed.png" />'; else echo  $Travel['JAM_BERANGKAT'] . " - " . $Travel['JAM_PULANG'];?></td>
                                                    <td><?php echo $Travel['KELAS_TRAVEL']; ?></td>
                                                    <td><?php 
															if($Travel['HARGA_TIKET'] == $hargaTravelMurah) echo $Travel['HARGA_TIKET'] . '<img src="../../../go3s/css/murah.png" />' ; else echo  $Travel['HARGA_TIKET'];?></td>
                                                    <td><?php echo CHtml::link('Pesan', array('profil/index', 'idTravel'=>$Travel['ID_TRAVEL'], 'idDetailTravel'=>$Travel['ID_DETAIL_TRAVEL']))?></td>
                                                </tr>
                                            <?php $row++;
											endforeach; }else{?>
                                                <tr align="center" id="genap">
                                                	<td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                </tr><?php }?>
                                      </table>
                                  </td>
                                </tr>
                            </table>
                            <table width="570" border="1">
                                <tr><?php $row = 0; ?>
                                    <td width="560"><h4><img src="../../../go3s/css/kereta.PNG" width="40" height="30" alt="kereta" />Kereta Api</h4>
                                        <table width="561" border="1">
                                          <tr id="theader">
                                                <th width="133" scope="col">Nama Kereta</th>
                                                <th width="51" scope="col">Kelas</th>
                                                <th width="113" scope="col">Waktu</th>
                                                <th width="149" scope="col">Deskripsi</th>
                                                <th width="81" scope="col">Harga(Rp)</th>
                                          </tr>
                                            <?php if($jmlKereta != 0){
												foreach ($Keretas as $Kereta) : ?>
                                                <?php if($row % 2 == 0) {?>
                                                <tr align="center" id="genap"><?php }
												else {?>
                                                <tr align="center" id="ganjil"><?php } ?>
                                                    <td><?php echo $Kereta['NAMA_KERETA']; ?></td>
                                                    <td><?php echo $Kereta['KELAS_KERETA']; ?></td>
                                                    <td><?php if(($Kereta['DURASI_KERETA']) == $lamaKereta) echo $Kereta['JAM_BERANGKAT'] . " - " . $Kereta['JAM_PULANG'] . '<img src="../../../go3s/css/speed.png" />'; else echo  $Kereta['JAM_BERANGKAT'] . " - " . $Kereta['JAM_PULANG'];?></td>
                                                    <td><?php echo $Kereta['DESKRIPSI_KERETA']; ?></td>
                                                    <td><?php 
															if($Kereta['HARGA_TIKET'] == $hargaKeretaMurah) echo  $Kereta['HARGA_TIKET'] . '<img src="../../../go3s/css/murah.png" />'; else echo  $Kereta['HARGA_TIKET'];?></td>
                                                </tr>
                                            <?php $row++;
											endforeach; } else{?>
                                                <tr align="center" id="genap">
                                                	<td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                    <td>-</td>
                                                </tr><?php }?>
                                        </table>
                                        <p>&nbsp;</p></td>
                                </tr>
                            </table>
                      <p>&nbsp;</p></td>
                    </tr>
                </table></td>
        </tr>
    </table>

    <?php
} else {
    echo '<h3>' . $content . '</h3>';
}
?>
</p>

<p>&nbsp;  </p>
